<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fmtt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <script type="text/javascript" src="/myhouse/static/manager/js/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/myhouse/static/manager/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="/myhouse/static/manager/css/main.css"/>
    <script type="text/javascript" src="/myhouse/static/manager/js/libs/modernizr.min.js"></script>
</head>
<body>
<jsp:include page="/inc/managerHead.jsp"></jsp:include>
<div class="container clearfix">
    <jsp:include page="/inc/managerLeft.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/myhouse/manager/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">用户管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="/myhouse/manager/userByName" method="get" id="sub">
                    <table class="search-tab">
                        <tr>
                            <th width="70">搜索:</th>
                            <td><input class="common-text" name="userName"  type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <script type="text/javascript">
            $(function (){
                $("#sub").submit(userByName);
            });
            function userByName(){
                if ($("#username").val() == ""){
                    return false;
                }else {
                    return true;
                }
            }
        </script>

        <div class="result-wrap">
            <form>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
<%--                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>--%>
                            <th>用户名</th>
                            <th>邮箱</th>
                            <th>手机号</th>
                            <th>注册时间</th>
                            <th>评论状态</th>
                            <th>操作</th>
                        </tr>
                        <c:forEach items="${requestScope.userList}" var="user">
                            <tr>
<%--                                <td class="tc"><input name="id[]" value="59" type="checkbox"></td>--%>
                                <td>${user.userName}</td>
                                <td>${user.userEmail}</td>
                                <td>${user.userPhone}</td>
                                <td><fmtt:formatDate value="${user.userRegtime}" pattern="yyyy-MM-dd HH:mm:ss"></fmtt:formatDate></td>
                                <td>
                                    <c:if test="${user.userBan == true}">
                                        正常
                                    </c:if>
                                    <c:if test="${user.userBan == false}">
                                        封禁
                                    </c:if>
                                </td>
                                <td>
                                    <c:if test="${user.userBan == true}">
                                        <a href="/myhouse/manager/banUser?id=${user.id}&&ban=${user.userBan}">封禁</a>
                                    </c:if>
                                    <c:if test="${user.userBan == false}">
                                        <a href="/myhouse/manager/banUser?id=${user.id}&&ban=${user.userBan}">解封</a>
                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                    <div style="text-align: center; margin-top: 50px">
                        <c:if test="${requestScope.pager.pageNO gt 1}">
                            <a href="/myhouse/manager/userPage?pno=${requestScope.pager.pageNO-1}"><span class="span">上一页</span></a>
                        </c:if>
                        <c:forEach begin="1" end="${requestScope.pager.pageCount}" var="i">
                            <c:if test="${requestScope.pager.pageNO == i}">
                                <a href="/myhouse/manager/userPage?pno=${i}" style="color: red"><span class="span">${i}</span></a>
                            </c:if>
                            <c:if test="${requestScope.pager.pageNO ne i}">
                                <a href="/myhouse/manager/userPage?pno=${i}" style="color: black"><span class="span">${i}</span></a>
                            </c:if>
                        </c:forEach>
                        <c:if test="${requestScope.pager.pageNO lt requestScope.pager.pageCount}">
                            <a href="/myhouse/manager/userPage?pno=${requestScope.pager.pageNO+1}"><span class="span">下一页</span></a>
                        </c:if>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>
</html>
<style type="text/css">
    .span{
        font-size: 20px;
        margin-left: 50px;
        margin-right: 50px;
    }
</style>